<?php use_javascript(plugin_web_path('orangehrmTLUAdminPlugin', 'js/saveEmploymentContractTypeSuccess')); ?>

<div id="saveEmploymentContractType" class="box">

    <div class="head">
        <?php $heading = (empty($form->employmentContractTypeId)) ? __("Add Employment Contract Type") : __("Edit Employment Contract Type") ?>
        <h1 id="saveEmploymentContractType"><?php echo $heading; ?></h1>
    </div>

    <div class="inner">

        <?php include_partial('global/flash_messages', array('prefix' => 'employmentcontracttype')); ?>

        <form name="frmSaveEmploymentContractType" id="frmSaveEmploymentContractType" method="post"
              action="<?php echo url_for('tluadmin/saveEmploymentContractType?employmentContractTypeId=' . $form->employmentContractTypeId); ?>"
              class="<?php echo empty($form->employmentContractTypeId) ? '' : 'clickToEditForm'; ?>">

            <?php echo $form['_csrf_token']; ?>

            <fieldset>

                <ol>

                    <li>
                        <?php echo $form['employmentContractTypeCode']->renderLabel(__('Employment Contract Type Code') . ' <em>*</em>'); ?>
                        <?php echo $form['employmentContractTypeCode']->render(array("maxlength" => 10)); ?>
                    </li>

                    <li>
                        <?php echo $form['employmentContractTypeName']->renderLabel(__('Employment Contract Type Name') . ' <em>*</em>'); ?>
                        <?php echo $form['employmentContractTypeName']->render(array("maxlength" => 100)); ?>
                    </li>

                    <li class="largeTextBox">
                        <?php echo $form['employmentContractTypeDescription']->renderLabel(__('Employment Contract Type Description')); ?>
                        <?php echo $form['employmentContractTypeDescription']->render(array("maxlength" => 1000)); ?>
                    </li>

                    <li class="required">
                        <em>*</em> <?php echo __(CommonMessages::REQUIRED_FIELD); ?>
                    </li>

                </ol>

                <p>
                    <input type="button" class="editButton" name="btnSave" id="btnSave"
                           value="<?php echo empty($form->employmentContractTypeId) ? __("Save") : __("Edit"); ?>"/>
                    <input type="button" class="reset" name="btnCancel" id="btnCancel"
                           value="<?php echo __("Cancel"); ?>"/>
                </p>

            </fieldset>

        </form>

    </div>

</div>

<script type="text/javascript">
    //<![CDATA[
    //we write javascript related stuff here, but if the logic gets lengthy should use a seperate js file
    var lang_edit = "<?php echo __("Edit"); ?>";
    var lang_save = "<?php echo __("Save"); ?>";
    var lang_employmentContractTypeCodeRequired = '<?php echo __(ValidationMessages::REQUIRED); ?>';
    var lang_employmentContractTypeNameRequired = '<?php echo __(ValidationMessages::REQUIRED); ?>';
    var viewEmploymentContractTypeListUrl = '<?php echo url_for('tluadmin/viewEmploymentContractTypeList?employmentContractTypeId='.$form->employmentContractTypeId); ?>';
    var employmentContractTypeId = '<?php echo $form->employmentContractTypeId; ?>';
    var lang_exceed10Chars = '<?php echo __(ValidationMessages::TEXT_LENGTH_EXCEEDS, array('%amount%' => 10)); ?>';
    var lang_exceed100Chars = '<?php echo __(ValidationMessages::TEXT_LENGTH_EXCEEDS, array('%amount%' => 100)); ?>';
    var lang_exceed1000Chars = '<?php echo __(ValidationMessages::TEXT_LENGTH_EXCEEDS, array('%amount%' => 1000)); ?>';
    var employmentContractTypes = <?php echo str_replace('&#039;', "'", $form->getEmploymentContractTypeListAsJson()) ?>;
    var employmentContractTypeList = eval(employmentContractTypes);
    var lang_uniqueCode = '<?php echo __(ValidationMessages::ALREADY_EXISTS); ?>';
    //]]>
</script>